﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace DISVotingButton
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
            Functionality.readXMLParameters();
            this.Left = Functionality.FormX;
            this.Top = Functionality.FormY;
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                button1.Tag = "1";
                Window2 diag = new Window2();
                if (diag.ShowDialog() == true)
                {
                    Functionality.writeVotingsToDB();
                }
                diag.button1.Tag = "0";
                diag.button2.Tag = "0";
                button1.Tag = "0";
            }
            catch (Exception ex)
            {
                Window5 diag = new Window5();
                diag.ShowDialog();
                diag.button1.Tag = "0";
                button1.Tag = "0";
            }
        }
    }
}
